<template>
  <div class>
    <div
      v-if="showInfo"
      class="cesiumdialog"
      :style="{
        left: winPos[0] - getscalepxcnum(0) + 'px',
        bottom: winPos[3] + 'px',
      }"
    >
      <div class="contain">
        <!-- 关闭图标 -->
        <i
          class="el-icon-close"
          :style="{
            position: 'absolute',
            right: getscalepxc(10),
            top: getscalepxc(6),
            fontSize: getscalepxc(12),
            pointerEvents: 'auto',
            cursor: 'pointer',
          }"
          @click="closecard()"
        ></i>
        <div style="position: absolute; top: 3px; left: 91px">
          <span
            style="
              display: inline-block;
              width: 14px;
              height: 12px;
              background: url(/configuration/ziyuan/reyonghu.png) no-repeat;
              background-size: 100% 100%;
              margin-left: 6px;
            "
          ></span>
          <span style="font-size: 13px; color: #ffe799">{{name}}</span>
        </div>
        <div class="textContain">
          <div style="display: flex; flex-direction: row;justify-content:space-around;height: 70%;width: 100%;padding-top: 20px;">
            <div class="fcbc">
              <div style="color: #a0c8db; padding-bottom: 3px">流量(t/h)</div>
              <div style="color: #ff6300">{{liuliang}}</div>
            </div>
            <div class="fcbc">
              <div style="color: #a0c8db; padding-bottom: 3px">压力(MPa)</div>
              <div style="color: #ff6300">{{yali}}</div>
            </div>
            <div class="fcbc">
              <div style="color: #a0c8db; padding-bottom: 3px">温度(℃)</div>
              <div style="color: #ff6300">{{wendu}}</div>
            </div>
          </div>
        </div>
      </div>
      <!-- <div class="smallcircle"></div>
      <div class="bigcircle"></div> -->
    </div>
  </div>
</template>
<script>
import uuidv1 from "uuid/v1";
import * as echarts from "echarts/dist/echarts";
import commonmixins from "@/mixins/bigScreen/commonmixins";

import basecard from "../base.vue";
import axios from "@/utils/requestdp";

export default {
  name: "reyonghucard",
  extends: basecard,
  mixins: [commonmixins],
  components: {},
  data() {
    return {
      name: "-",
      liuliang: "-",
      yali: "-",
      wendu: "-",
    };
  },
  computed: {},
  watch: {},
  mounted() {
    this.instance.show = false
    // this.instance.scale = 0.3
    // this.instance.imageUrl = '/configuration/ziyuan/gaojing.png'
    this.loaddata()
  },
  methods: {
    loaddata() {
      let r = this.options.item;
      let pid = r.id.split(".")[1]

      this.name = this.options.item.name;

      console.log(this.options.item.name);

      let params = {
        queries: [
          {
            metric: "pid,name,m_012t,m_012p,m_013q",
            schema: "monitor",
          },
        ],
        type: "lastest",
        search: `(pid=${pid})`, //热用户的id
        table: "heatconsumer",
      };

      if (
        r.id.split(".")[0] == "heatplant" ||
        r.id.split(".")[0] == "heatsource"
      ) {
        params = {
          queries: [
            {
              metric: "pid,name,m_011t,m_011p,m_009q",
              schema: "monitor",
            },
          ],
          type: "lastest",
          search: `(pid=${pid})`, //热源的id
          table: "heatsource",
        };
      }

      /*****
      热用户：
      {
          "queries": [
              {
                  "metric": "pid,name,m_012t,m_012p,m_013q",
                  "schema": "monitor"
              }
          ],
          "type": "lastest",
          "search":"(pid=117)",  //热用户的id
          "table": "heatconsumer"
      }
      热源：
      {
          "queries": [
              {
                  "metric": "pid,name,m_011t,m_011p,m_009q",
                  "schema": "monitor"
              }
          ],
          "type": "lastest",
          "search":"(pid=1)",  //热源的id
          "table": "heatsource"
      }
       */

      axios.post("/open/queryDb", params).then((res) => {
        console.log(res);
      });
    },
  },
};
</script>
<style lang='scss' scoped>
.cesiumdialog {
  pointer-events: none;
  position: absolute;
  // width: 500px;
  // height: 400px;
  // color: #aed2e2;
  // background-image: url("/configuration/beijing/dialog.png");
  // background-size: 100% 100%;
  // background-color: #fff0;
  // padding: 5px;
  // border-radius: 5px;
  // pointer-events: none;
  // cursor: pointer;
  // font-size: 18px;
  // font-size: 18px;
}
.contain {
  position: absolute;
  height: 90px;
  width: 400px;
  left: -3px;
  top: -87px;
  color: white;
  background-size: 100% 100%;
  padding: 5px;
  border-radius: 5px;
  cursor: pointer;
  background-image: url("/configuration/ziyuan/xunjiandia.png");
}
.textContain {
  position: absolute;
  cursor: pointer;
  line-height: 15px;
  top: 20px;
  bottom: 0px;
  left: 91px;
  color: white;
  padding: 2px;
  width: 305px;
}
.textItem {
  display: block;
  font-size: 14px;
  color: #ffffff;
  line-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
}
@keyframes scale {
  0% {
    transform: scale(1);
  }
  50%,
  75% {
    transform: scale(3);
  }
  78%,
  100% {
    opacity: 0;
  }
}
@keyframes scales {
  0% {
    transform: scale(1);
  }
  50%,
  75% {
    transform: scale(2);
  }
  78%,
  100% {
    opacity: 0;
  }
}
.smallcircle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #F12711;
  opacity: 0.8;
  border-radius: 50%;
  top: -4px;
  left: -6px;
}
.smallcircle:before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.4;
  background-color: #F12711;
  opacity: 0.8;
  animation: scale 1s infinite cubic-bezier(0, 0, 0.49, 1.02);
}
.bigcircle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.4;
  background-color: #F12711;
  opacity: 0.8;
  animation: scales 1s infinite cubic-bezier(0, 0, 0.49, 1.02);
  top: -4px;
  left: -6px;
}
</style>